PENCIL v1.0 – SCHOOL MANAGEMENT FOR MANY SCHOOLS
=================================================
Made 3 December 2026 from the latest Xcellence system (Website v2.5).
Every feature is carried over: web portal (Staff + Student systems),
Parent app, Staff app, Admin app, demo apps – plus a demo web portal,
a Pencil Console for adding schools, and a Pencil home page.

WHAT IS IN THIS FOLDER
   public_html\        the Pencil website + apps (upload to the hosting)
   pencil-data\        settings of Pencil and of every school (upload NEXT TO
                       public_html, not inside it)
   Demo builder\       tools that make the demo sample data (keep on the PC)
   Logos\              the four logo ideas (SVG + PNG)
   Pencil V1.0.zip     everything above in one file


1. HOW PENCIL SERVES MANY SCHOOLS
   One copy of Pencil on one hosting account. Every school has:
     - its own address       greenfield.pencil.lk  (sub-domain of your domain)
                             or its own domain, e.g. portal.greenfield.lk
     - its own database      (staff, students, fees ... never mixed)
     - its own settings file pencil-data\schools\greenfield.php
       (name, logo, motto, houses + colours, class divisions, intakes and
        their first month, pre-school year names, sections + school hours,
        departments, receipt prefix, EPF/ETF %, app names, plan, paid-until)
   Each school's apps open at its own address:
       https://greenfield.pencil.lk/parent/   /app/   /admin/
   Pencil picks the school from the address, so nothing else is needed.

   Special addresses
       https://pencil.lk/               Pencil home page (for selling)
       https://pencil.lk/console/       Pencil Console (only for you)
       https://demo.pencil.lk/          DEMO web portal (sample school)
       https://demo.pencil.lk/demo/     DEMO phone apps (QR codes)
   ("pencil.lk" is only an example – use the domain you buy.)


2. PUT IT ONLINE (cPanel hosting, PHP 8.1+, MySQL / MariaDB)
   a) Buy the domain and point it to the hosting.
   b) cPanel > Domains: make the domain's document root  public_html.
      cPanel > Subdomains (or Domains): add the WILDCARD sub-domain
      *.yourdomain  with the SAME document root (public_html).
      Turn on SSL for both (AutoSSL / Let's Encrypt wildcard) – the apps
      need https.
   c) Upload: unzip Pencil V1.0.zip on the PC, then upload
          public_html\*   ->  /home/<cpanel user>/public_html/
          pencil-data\    ->  /home/<cpanel user>/pencil-data/
      (pencil-data must be writable by PHP – normally it is.)
   d) Edit pencil-data\pencil.php: 'domain' => 'yourdomain', support e-mail
      and phone. (Or later in Console > Settings.)
   e) E-mail: in cPanel > Email Accounts create no-reply@yourdomain
      (used for "forgot password" and clear-data codes).
   f) Open https://yourdomain/check.php to see that PHP is ready.


3. THE DEMO SCHOOL (for pitching)
   a) cPanel > MySQL Databases: create a database and a user, give the user
      ALL PRIVILEGES on it. Put the names and password in
      pencil-data\schools\demo.php  (the 'db' line).
   b) Open https://demo.yourdomain/ – the sample data loads by itself.
   Demo web portal
      - One-tap sign-in: "Main Admin (Principal)" or "Office staff"
        (principal@demo.school / office@demo.school, password Demo@1234).
        System passwords are filled in for you (Staff@1234 / Student@1234).
      - "Today" is always Wed 2 Dec 2026 10:40, so every page has data.
      - Visitors can change anything. The sample data loads again when
        someone opens the demo after 20 quiet minutes, or with the orange
        "Reset demo" button. No e-mails are sent – codes show on screen.
   Demo phone apps  (https://demo.yourdomain/demo/)
      - Pencil Parents / Staff / Admin with an orange DEMO ribbon, no sign-in,
        work offline, install next to real apps.
      - NEW: in the demo Admin app, "More > website" pages now open the demo
        web portal (signed in as the Principal) instead of "Not in the demo".
   Live apps on the demo school (also possible): open
      https://demo.yourdomain/app/  staff no. 101, password Demo@1234
      https://demo.yourdomain/parent/  NIC 198512304567, password Demo@1234
      https://demo.yourdomain/admin/  principal@demo.school / Demo@1234
      These are the real apps on the demo database – what one person does
      shows up for the others (e.g. apply leave in Staff, approve in Admin).


4. ADD A NEW SCHOOL (about 5 minutes)
   1) cPanel > MySQL Databases: new database + user (ALL PRIVILEGES).
   2) https://yourdomain/console/  – first password  Pencil@2026
      (change it at once: Console > Settings).
   3) "Add school": code (e.g. greenfield = greenfield.yourdomain), name,
      logo, database details, houses, intakes, sections ... Save.
   4) Open the school > "Set up database" and type the first Main Admin
      (name, e-mail, password). Done – the school can sign in.
   5) Send the school its links (shown on the school's Console page).
      RFID readers (ESP32) must send to  https://<code>.yourdomain/getdata.php
      – change the address in the reader's firmware for each school, then
      add the reader on the school's Devices page as before.
   Pause a school (e.g. not paid): Console > school > "Pause school".
   Its website and apps then show "account paused" until you resume it.
   "Paid until": the school's Main Admin sees a reminder 30 days before.


5. MOVING XCELLENCE ONTO PENCIL (optional)
   Xcellence's database already has the same tables. Add a school
   "xcellence" in the Console with Xcellence's current database details,
   houses Phoenix/Griffin/Pegasus/Unicorn, intakes Pre School (January) and
   International School (September), pre-school years Play Group / Second
   Year / Final Year, receipt prefix XIS, and its logo. Copy the old
   uploads folder to pencil-data\schools\xcellence\uploads\.
   Test on xcellence.yourdomain before telling staff and parents (they
   will need to install the apps again from the new address).


6. WHAT CHANGED FROM XCELLENCE v2.5
   - Product name Pencil, Pencil logo and icons on all apps, "Powered by
     Spectran Technologies PVT Ltd" kept on sign-in, footer, receipts and
     payslips. School name / logo / motto now come from the school settings.
   - One database per school; uploads per school (pencil-data\schools\
     <code>\uploads – outside the website folder).
   - Old Xcellence-only files removed (old redirects, upgrade SQL,
     "Purple -> Unicorn" fix). New schools get includes\pencil_schema.sql.
   - App versions start again at 1.0.0 (Parent, Staff, Admin).
   - Things still fixed for every school: money is shown in "Rs.", the
     two intakes are "pre-school years (3)" and "Grade 1–13", the student
     form lists (religion, ethnicity, districts) are Sri Lankan.


7. EVERY NEW PENCIL VERSION
   - Keep the demo standard: public_html\demo and pencil-data\schools\demo\
     demo.sql are refreshed with the Demo builder (see its README) and are
     part of every version's package.
   - Upload public_html as before; never overwrite the schools' files in
     pencil-data\schools\ (only demo\demo.sql changes).
